  //const { h, render, Component } = preact;
  //const { useState, useEffect, useCallback } = preactHooks;
  import { h, render, Component ,useState, useEffect, useCallback,useRef} from 'preact';
  JSX = h;
  const Clock = () => {
    const [time, setTime] = useState(Date.now());
    const timer = useRef();

    useEffect(() => {
      // update time every second
      timer.current = setInterval(() => {
        setTime(Date.now());
      }, 1000);

      return () => {
        // stop when not renderable
        clearInterval(timer.current);
      };
    }, []);

    return (
      <h2>
        PReact's time:<span>{new Date(time).toLocaleTimeString()}</span>
      </h2>
    );
  };
  export default Clock
  //document.$("div#preact").patch(<Clock />)
  //render(<Clock />, document.getElementById("preact"));